package org.hxzon.blogbackup.baidu;

import org.hxzon.util.FileNameUtil;

public class BlogImage {
    private String alt;
    private String src;
    private String name;
    private BlogFile file;

    public String getFileName() {
        if (name == null) {
            name = src.substring(src.lastIndexOf("/") + 1);
            name = FileNameUtil.windowsFileName(name);
            name = file.getShortFileName() + "." + name;
        }
        return name;
    }

    public String getFullFilePath() {
        return getFile().getCategoryText() + "/image/" + getFileName();
    }

    public String getFilePath() {
        return "image/" + getFileName();
    }

    public String getAlt() {
        return alt;
    }

    public void setAlt(String alt) {
        this.alt = alt;
    }

    public String getSrc() {
        return src;
    }

    public void setSrc(String src) {
        this.src = src;
    }

    public void setName(String name) {
        this.name = name;
    }

    public BlogFile getFile() {
        return file;
    }

    public void setFile(BlogFile file) {
        this.file = file;
    }

}
